package com.dddpeter.app.controller;

import com.dddpeter.app.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/api")
public class IndexController {
    @Autowired
    TestService testService;

    @GetMapping("/")
    public Map<String, Object> index(){
        Map<String, Object> response = new HashMap<>();
        response.put("message", testService.test());
        response.put("status", "success");
        response.put("timestamp", System.currentTimeMillis());
        return response;
    }
    
    @GetMapping("/health")
    public Map<String, Object> health(){
        Map<String, Object> response = new HashMap<>();
        response.put("status", "UP");
        response.put("service", "Spring Boot + Vue App");
        response.put("timestamp", System.currentTimeMillis());
        return response;
    }
}
